﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Practices.Unity;
using SISLOG.BusinessEntities;
using SISLOG.BusinessLogic;

namespace SISLOG.Web
{
    public partial class frmProveedor : BasePage<frmProveedor>//System.Web.UI.Page
    {
        [Dependency]

        public IProveedorBL ProveedorBL { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            GridView1.DataSource = ProveedorBL.GetAllFromProveedor();
            GridView1.DataBind();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect("frmCRUDProveedor.aspx?acc=nuevo");
        }

        protected void botonBuscar_Click(object sender, EventArgs e)
        {
            List<Proveedor> listaProveedor = new List<Proveedor>();

            if (RadioButton1.Checked)
            {
                listaProveedor = ProveedorBL.GetAllFromProveedorByRUC(TextBox1.Text);
            }
            else
            {
                listaProveedor = ProveedorBL.GetAllFromProveedorByCriterio(TextBox1.Text);
            }

            GridView1.DataSource = listaProveedor;//para cargar los datos en la grilla
            GridView1.DataBind();//mostrar los datos de la grilla
        }
    }
}